version = "0.0.1-pre"
dependencies = [
"curl 0.0.1 (git+https://github.com/alexcrichton/curl-rust?ref=bundle#720d87fa32c738c397252cf3c26d428bdca697d4)",
- "docopt 0.6.3 (git+https://github.com/docopt/docopt.rs#ee3844098f213121ce7dfb32cdbf2512ecba7085)",
- "docopt_macros 0.6.3 (git+https://github.com/docopt/docopt.rs#ee3844098f213121ce7dfb32cdbf2512ecba7085)",
+ "docopt 0.6.3 (git+https://github.com/docopt/docopt.rs#ca5a09aba10c5040220efe9d237a430f3b924736)",
+ "docopt_macros 0.6.3 (git+https://github.com/docopt/docopt.rs#ca5a09aba10c5040220efe9d237a430f3b924736)",
"flate2 0.0.1 (git+https://github.com/alexcrichton/flate2-rs#a59b2a103642550bc1500c302c5031479ec7d9e1)",
- "git2 0.0.1 (git+https://github.com/alexcrichton/git2-rs#05276ae6dce9d3945104ffefb9e1496323351398)",
+ "git2 0.0.1 (git+https://github.com/alexcrichton/git2-rs#08dc5e62bf11ff8957fcb98c0c3c57c764fc4879)",
"glob 0.0.1 (git+https://github.com/rust-lang/glob#ce24c37f268c4a31238dbe3b8e9ff8fe5342f0be)",
"hamcrest 0.1.0 (git+https://github.com/carllerche/hamcrest-rust.git#49061a2134d9112b8622d54587590f324b97cc98)",
"semver 0.0.1 (git+https://github.com/rust-lang/semver#df163f7b22686493b037eee1f1f9d1a2742f9bbe)",
"tar 0.0.1 (git+https://github.com/alexcrichton/tar-rs#b2391703d54afd20c999d5531c4ed46bcf366f23)",
- "toml 0.1.0 (git+https://github.com/alexcrichton/toml-rs#5f5bd93203aa4c8e0602eb4def2d73d385cba74c)",
- "url 0.1.0 (git+https://github.com/servo/rust-url#bfdf809365600a7941a77524f9bb065886de3379)",
+ "toml 0.1.0 (git+https://github.com/alexcrichton/toml-rs#22ad6e7ea9f2a81aac3ba9e427dd8a1036453486)",
+ "url 0.1.0 (git+https://github.com/servo/rust-url#275c4a8e1926ab87247203817c9c812e9b83a49f)",
]
[[package]]
dependencies = [
"curl-sys 0.0.1 (git+https://github.com/alexcrichton/curl-rust?ref=bundle#720d87fa32c738c397252cf3c26d428bdca697d4)",
"link-config 0.0.1 (git+https://github.com/alexcrichton/link-config#1d3cd271612036b47c015a55f33a97e1524569ae)",
- "url 0.1.0 (git+https://github.com/servo/rust-url#bfdf809365600a7941a77524f9bb065886de3379)",
+ "url 0.1.0 (git+https://github.com/servo/rust-url#275c4a8e1926ab87247203817c9c812e9b83a49f)",
]
[[package]]
[[package]]
name = "docopt"
version = "0.6.3"
-source = "git+https://github.com/docopt/docopt.rs#ee3844098f213121ce7dfb32cdbf2512ecba7085"
+source = "git+https://github.com/docopt/docopt.rs#ca5a09aba10c5040220efe9d237a430f3b924736"
[[package]]
name = "docopt_macros"
version = "0.6.3"
-source = "git+https://github.com/docopt/docopt.rs#ee3844098f213121ce7dfb32cdbf2512ecba7085"
+source = "git+https://github.com/docopt/docopt.rs#ca5a09aba10c5040220efe9d237a430f3b924736"
dependencies = [
- "docopt 0.6.3 (git+https://github.com/docopt/docopt.rs#ee3844098f213121ce7dfb32cdbf2512ecba7085)",
+ "docopt 0.6.3 (git+https://github.com/docopt/docopt.rs#ca5a09aba10c5040220efe9d237a430f3b924736)",
]
[[package]]
name = "encoding"
version = "0.1.0"
-source = "git+https://github.com/lifthrasiir/rust-encoding#35f0d70f65f73ba16f296f9ec675eddee661ba79"
+source = "git+https://github.com/lifthrasiir/rust-encoding#28eafb604a92c7786685b46c0fc02682ba3ab265"
[[package]]
name = "flate2"
[[package]]
name = "git2"
version = "0.0.1"
-source = "git+https://github.com/alexcrichton/git2-rs#05276ae6dce9d3945104ffefb9e1496323351398"
+source = "git+https://github.com/alexcrichton/git2-rs#08dc5e62bf11ff8957fcb98c0c3c57c764fc4879"
dependencies = [
- "libgit2 0.0.1 (git+https://github.com/alexcrichton/git2-rs#05276ae6dce9d3945104ffefb9e1496323351398)",
- "url 0.1.0 (git+https://github.com/servo/rust-url#bfdf809365600a7941a77524f9bb065886de3379)",
+ "libgit2 0.0.1 (git+https://github.com/alexcrichton/git2-rs#08dc5e62bf11ff8957fcb98c0c3c57c764fc4879)",
+ "url 0.1.0 (git+https://github.com/servo/rust-url#275c4a8e1926ab87247203817c9c812e9b83a49f)",
]
[[package]]
[[package]]
name = "libgit2"
version = "0.0.1"
-source = "git+https://github.com/alexcrichton/git2-rs#05276ae6dce9d3945104ffefb9e1496323351398"
+source = "git+https://github.com/alexcrichton/git2-rs#08dc5e62bf11ff8957fcb98c0c3c57c764fc4879"
dependencies = [
"libssh2-static-sys 0.0.1 (git+https://github.com/alexcrichton/libssh2-static-sys#6a5d3ad7b62db6ca0721c528402f4976a1876036)",
"link-config 0.0.1 (git+https://github.com/alexcrichton/link-config#1d3cd271612036b47c015a55f33a97e1524569ae)",
[[package]]
name = "toml"
version = "0.1.0"
-source = "git+https://github.com/alexcrichton/toml-rs#5f5bd93203aa4c8e0602eb4def2d73d385cba74c"
+source = "git+https://github.com/alexcrichton/toml-rs#22ad6e7ea9f2a81aac3ba9e427dd8a1036453486"
[[package]]
name = "url"
version = "0.1.0"
-source = "git+https://github.com/servo/rust-url#bfdf809365600a7941a77524f9bb065886de3379"
+source = "git+https://github.com/servo/rust-url#275c4a8e1926ab87247203817c9c812e9b83a49f"
dependencies = [
- "encoding 0.1.0 (git+https://github.com/lifthrasiir/rust-encoding#35f0d70f65f73ba16f296f9ec675eddee661ba79)",
+ "encoding 0.1.0 (git+https://github.com/lifthrasiir/rust-encoding#28eafb604a92c7786685b46c0fc02682ba3ab265)",
]
enum AdequateTerminal<'a> {
NoColor(Box<Writer+'a>),
- Color(Box<Terminal<Box<Writer+'a>>+'a>)
+ Colored(Box<Terminal<Box<Writer+'a>>+'a>)
}
pub struct Shell<'a> {
if config.tty && config.color {
let term: Option<term::TerminfoTerminal<Box<Writer+'a>>> = Terminal::new(out);
term.map(|t| Shell {
- terminal: Color(box t as Box<Terminal<Box<Writer+'a>>>),
+ terminal: Colored(box t as Box<Terminal<Box<Writer+'a>>>),
config: config
}).unwrap_or_else(|| {
Shell { terminal: NoColor(box stderr() as Box<Writer+'a>), config: config }
fn fg(&mut self, color: color::Color) -> IoResult<bool> {
match self.terminal {
- Color(ref mut c) => c.fg(color),
+ Colored(ref mut c) => c.fg(color),
NoColor(_) => Ok(false)
}
}
fn bg(&mut self, color: color::Color) -> IoResult<bool> {
match self.terminal {
- Color(ref mut c) => c.bg(color),
+ Colored(ref mut c) => c.bg(color),
NoColor(_) => Ok(false)
}
}
fn attr(&mut self, attr: Attr) -> IoResult<bool> {
match self.terminal {
- Color(ref mut c) => c.attr(attr),
+ Colored(ref mut c) => c.attr(attr),
NoColor(_) => Ok(false)
}
}
fn supports_attr(&self, attr: Attr) -> bool {
match self.terminal {
- Color(ref c) => c.supports_attr(attr),
+ Colored(ref c) => c.supports_attr(attr),
NoColor(_) => false
}
}
fn reset(&mut self) -> IoResult<()> {
match self.terminal {
- Color(ref mut c) => c.reset(),
+ Colored(ref mut c) => c.reset(),
NoColor(_) => Ok(())
}
}
fn get_ref<'b>(&'b self) -> &'b Box<Writer+'a> {
match self.terminal {
- Color(ref c) => c.get_ref(),
+ Colored(ref c) => c.get_ref(),
NoColor(ref w) => w
}
}
fn get_mut<'b>(&'b mut self) -> &'b mut Box<Writer+'a> {
match self.terminal {
- Color(ref mut c) => c.get_mut(),
+ Colored(ref mut c) => c.get_mut(),
NoColor(ref mut w) => w
}
}
impl<'a> Writer for Shell<'a> {
fn write(&mut self, buf: &[u8]) -> IoResult<()> {
match self.terminal {
- Color(ref mut c) => c.write(buf),
+ Colored(ref mut c) => c.write(buf),
NoColor(ref mut n) => n.write(buf)
}
}
fn flush(&mut self) -> IoResult<()> {
match self.terminal {
- Color(ref mut c) => c.flush(),
+ Colored(ref mut c) => c.flush(),
NoColor(ref mut n) => n.flush()
}
}
Ok(())
}
-fn emit_package(dep: &toml::Table, out: &mut String) {
+fn emit_package(dep: &toml::TomlTable, out: &mut String) {
out.push_str(format!("name = {}\n", lookup(dep, "name")).as_slice());
out.push_str(format!("version = {}\n", lookup(dep, "version")).as_slice());
});
}
-fn lookup<'a>(table: &'a toml::Table, key: &str) -> &'a toml::Value {
+fn lookup<'a>(table: &'a toml::TomlTable, key: &str) -> &'a toml::Value {
table.find(&key.to_string()).expect(format!("Didn't find {}", key).as_slice())
}
#[deriving(Show)]
pub enum PlatformRequirement {
- Target,
- Plugin,
- PluginAndTarget,
+ PlatformTarget,
+ PlatformPlugin,
+ PlatformPluginAndTarget,
}
pub struct Context<'a, 'b> {
let targets = pkg.get_targets().iter();
for target in targets.filter(|t| t.get_profile().is_compile()) {
- self.build_requirements(pkg, target, Target, &mut HashSet::new());
+ self.build_requirements(pkg, target, PlatformTarget,
+ &mut HashSet::new());
}
self.compilation.extra_env.insert("NUM_JOBS".to_string(),
if !visiting.insert(pkg.get_package_id()) { return }
let key = (pkg.get_package_id(), target.get_name());
- let req = if target.get_profile().is_plugin() {Plugin} else {req};
+ let req = if target.get_profile().is_plugin() {PlatformPlugin} else {req};
self.requirements.insert_or_update_with(key, req, |_, v| {
*v = v.combine(req);
});
pub fn get_requirement(&self, pkg: &'a Package,
target: &'a Target) -> PlatformRequirement {
self.requirements.find(&(pkg.get_package_id(), target.get_name()))
- .map(|a| *a).unwrap_or(Target)
+ .map(|a| *a).unwrap_or(PlatformTarget)
}
/// Switch this context over to being the primary compilation unit,
impl PlatformRequirement {
fn combine(self, other: PlatformRequirement) -> PlatformRequirement {
match (self, other) {
- (Target, Target) => Target,
- (Plugin, Plugin) => Plugin,
- _ => PluginAndTarget,
+ (PlatformTarget, PlatformTarget) => PlatformTarget,
+ (PlatformPlugin, PlatformPlugin) => PlatformPlugin,
+ _ => PlatformPluginAndTarget,
}
}
}
use self::job::{Job, Work};
use self::job_queue::{JobQueue, StageStart, StageCustomBuild, StageLibraries};
use self::job_queue::{StageBinaries, StageEnd};
-use self::context::{Context, PlatformRequirement, Target, Plugin, PluginAndTarget};
+use self::context::{Context, PlatformRequirement, PlatformTarget};
+use self::context::{PlatformPlugin, PlatformPluginAndTarget};
pub use self::compilation::Compilation;
KindPlugin));
Ok(match req {
- Target => vec![(target_cmd, KindTarget)],
- Plugin => vec![(plugin_cmd, KindPlugin)],
- PluginAndTarget if cx.config.target().is_none() =>
+ PlatformTarget => vec![(target_cmd, KindTarget)],
+ PlatformPlugin => vec![(plugin_cmd, KindPlugin)],
+ PlatformPluginAndTarget if cx.config.target().is_none() =>
vec![(target_cmd, KindTarget)],
- PluginAndTarget => vec![(target_cmd, KindTarget),
- (plugin_cmd, KindPlugin)],
+ PlatformPluginAndTarget => vec![(target_cmd, KindTarget),
+ (plugin_cmd, KindPlugin)],
})
}
use std::{fmt, os, result, mem};
use std::io::fs::{PathExtensions, File};
use std::collections::HashMap;
+use std::string;
+
use serialize::{Encodable,Encoder};
use toml;
use core::MultiShell;
home_path: Path,
shell: &'a mut MultiShell<'a>,
jobs: uint,
- target: Option<String>,
- linker: Option<String>,
- ar: Option<String>,
+ target: Option<string::String>,
+ linker: Option<string::String>,
+ ar: Option<string::String>,
}
impl<'a> Config<'a> {
pub fn new<'a>(shell: &'a mut MultiShell,
jobs: Option<uint>,
- target: Option<String>) -> CargoResult<Config<'a>> {
+ target: Option<string::String>) -> CargoResult<Config<'a>> {
if jobs == Some(0) {
return Err(human("jobs must be at least 1"))
}
self.target.as_ref().map(|t| t.as_slice())
}
- pub fn set_ar(&mut self, ar: String) { self.ar = Some(ar); }
+ pub fn set_ar(&mut self, ar: string::String) { self.ar = Some(ar); }
- pub fn set_linker(&mut self, linker: String) { self.linker = Some(linker); }
+ pub fn set_linker(&mut self, linker: string::String) { self.linker = Some(linker); }
pub fn linker(&self) -> Option<&str> {
self.linker.as_ref().map(|t| t.as_slice())
#[deriving(Eq,PartialEq,Clone,Decodable)]
pub enum ConfigValue {
- String(String, Path),
- List(Vec<(String, Path)>),
- Table(HashMap<String, ConfigValue>),
+ String(string::String, Path),
+ List(Vec<(string::String, Path)>),
+ Table(HashMap<string::String, ConfigValue>),
Boolean(bool, Path),
}
match *self {
String(ref string, _) => string.encode(s),
List(ref list) => {
- let list: Vec<&String> = list.iter().map(|s| s.ref0()).collect();
+ let list: Vec<&string::String> = list.iter().map(|s| s.ref0()).collect();
list.encode(s)
}
Table(ref table) => table.encode(s),
}
}
- pub fn table(&self) -> CargoResult<&HashMap<String, ConfigValue>> {
+ pub fn table(&self) -> CargoResult<&HashMap<string::String, ConfigValue>> {
match *self {
Table(ref table) => Ok(table),
_ => Err(internal(format!("expected a table, but found a {}",
}
}
- pub fn list(&self) -> CargoResult<&[(String, Path)]> {
+ pub fn list(&self) -> CargoResult<&[(string::String, Path)]> {
match *self {
List(ref list) => Ok(list.as_slice()),
_ => Err(internal(format!("expected a list, but found a {}",
human(format!("`{}` not found in your configuration", key)))
}
-pub fn all_configs(pwd: Path) -> CargoResult<HashMap<String, ConfigValue>> {
+pub fn all_configs(pwd: Path) -> CargoResult<HashMap<string::String, ConfigValue>> {
let mut cfg = Table(HashMap::new());
try!(walk_tree(&pwd, |mut file| {
Global => cfg.home_path.join(".cargo").join("config"),
Project => unimplemented!(),
};
- let contents = File::open(&file).read_to_string().unwrap_or(String::new());
+ let contents = File::open(&file).read_to_string().unwrap_or("".to_string());
let mut toml = try!(cargo_toml::parse(contents.as_slice(), &file));
toml.insert(key.to_string(), value.into_toml());
try!(File::create(&file).write(toml::Table(toml).to_string().as_bytes()));
}
}
-pub fn parse(toml: &str, file: &Path) -> CargoResult<toml::Table> {
+pub fn parse(toml: &str, file: &Path) -> CargoResult<toml::TomlTable> {
let mut parser = toml::Parser::new(toml.as_slice());
match parser.parse() {
Some(toml) => return Ok(toml),
struct TomlTarget {
name: String,
crate_type: Option<Vec<String>>,
- path: Option<TomlPath>,
+ path: Option<TomlPathValue>,
test: Option<bool>,
doctest: Option<bool>,
bench: Option<bool>,
}
#[deriving(Decodable, Clone)]
-enum TomlPath {
+enum TomlPathValue {
TomlString(String),
TomlPath(Path),
}
}
}
-impl TomlPath {
+impl TomlPathValue {
fn to_path(&self) -> Path {
match *self {
TomlString(ref s) => Path::new(s.as_slice()),
}
}
-impl fmt::Show for TomlPath {
+impl fmt::Show for TomlPathValue {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
TomlString(ref s) => s.fmt(f),